package com.buba.springcloud.controller;

import com.buba.springcloud.pojo.Dept;
import com.buba.springcloud.service.DeptClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.List;

/**
 * @author 张宇飞
 * @Description:
 * @date 2021/8/917:17
 */
@RestController
public class DeptConsumerController {

    private DeptClientService deptClientService;

    @RequestMapping("/consumer/dept/get/{deptId}")
    public Dept get(@PathVariable("deptId") long deptId) {
        return this.deptClientService.selDeptById(deptId);
    }

    @RequestMapping("/consumer/dept/add")
    public boolean add(Dept dept) {
        return this.deptClientService.addDept(dept);
    }

    @RequestMapping("/consumer/dept/list")
    public List<Dept> list() {
        return this.deptClientService.selDept();
    }


    @Autowired
    public void setDeptClientService(DeptClientService deptClientService) {
        this.deptClientService = deptClientService;
    }


}
